home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 11 / AMUG BBS in a Box Volume XI (April 1994) (MacWizards).iso / Files / Prog / M / Mini.sit / mini / launch.c / launch.c
Encoding:
C/C++ Source or Header  |  1987-06-04  |  1.9 KB  |  76 lines  |  [TEXT/MPS ]

  1. /* This file contains the launch utility for MiniTerm 
  2.  
  3.     Jerry LeVan
  4.     325 Boone Trail
  5.     Richmond Ky 40475
  6.     
  7.     May 1985
  8.     
  9. */
  10. #include <types.h>
  11. #include <packages.h>
  12. #include <files.h>
  13.  
  14. typedef struct LaunchStruct 
  15.    { char * fName;  /* a pascal string (name of application) */
  16.      long  param;    /* sound, video buffers to use  */
  17.     } LaunchStruct;
  18.  
  19. pascal void Launch1(anApp)
  20.   LaunchStruct *anApp; extern 0x205f;    /* move.l (sp)+,a0 */
  21.   
  22. pascal void Launch2() extern 0xa9f2;    /* _Launch           */
  23.  
  24. #define Launch(whichOne) \
  25. Launch1(whichOne); Launch2()
  26.  
  27. extern Boolean showClock;
  28.  
  29. /********************************************************************/ 
  30. #define __SEG__ LaunchApp
  31. void LaunchAppl(port,asciiReceive,logfile,asciiSend,thefile)
  32.   short port;            /* which port we are using sPortA,sPortB */
  33.   Boolean asciiReceive;    /* true if we are capturing a file */
  34.   short logfile;        /* refnum of open receiving file */
  35.   Boolean asciiSend;    /* true if we are sending a file */
  36.   short thefile;            /* refnum of the file we are sending */
  37.   {
  38.     Point loc;
  39.     SFTypeList typeList;
  40.     SFReply reply;
  41.     LaunchStruct Launch_Data;
  42.     
  43.     loc.v = 80;
  44.     loc.h = 100;
  45.       
  46.     typeList[0] = 'APPL';
  47.     
  48.     SFGetFile(&loc, 0, 0, 1, typeList, 0, &reply);
  49.     
  50.     if( reply.good  )
  51.     {
  52.      /* if the reply was good then we must set the default volume
  53.         after closing open files and removing any vbl tasks */
  54.         
  55.       if(asciiReceive) FSClose(logfile); 
  56.             
  57.       if (asciiSend) FSClose(thefile);
  58.                        
  59.       if(showClock)stopClock(); 
  60.       
  61.      /* close the port */
  62.        RAMSDClose(port);
  63.        
  64.      /* set default vol for launch */
  65.       SetVol(nil,reply.vRefNum);
  66.    
  67.      /* launch the target application */
  68.       Launch_Data.fName = &reply.fName;
  69.       Launch_Data.param = 0;        /* standard sound/video buffers */
  70.       
  71.       Launch(&Launch_Data);    /* adios */
  72.       
  73.      }
  74.    } /* LaunchAppl */
  75.    
  76.